from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from .models import User


@admin.register(User)
class UserAdmin(BaseUserAdmin):
    list_display = ['username', 'email', 'phone', 'student_id', 'school', 'is_active', 'created_at']
    list_filter = ['is_active', 'is_staff', 'school', 'grade']
    search_fields = ['username', 'email', 'phone', 'student_id']
    fieldsets = BaseUserAdmin.fieldsets + (
        ('扩展信息', {
            'fields': ('phone', 'avatar', 'gender', 'student_id', 'school', 'major', 'grade', 'bio')
        }),
    )
